<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="tutorial.css">
<TITLE>
How do I make things happen at compile time?
</TITLE>
</HEAD>
<BODY >
<A HREF="tutorial008.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="tutorial003.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="tutorial010.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc16">2.6</A>&nbsp;&nbsp;How do I make things happen at compile time?</H2>

A file being compiled may contain queries. These are goals
<A NAME="@default7"></A> preceded by either the symbol &#8220;?-&#8221; or the symbol
&#8220;:-&#8221;. As soon as a query or command is encountered in the
compilation of a file, the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> system will try to satisfy it.
Thus by inserting goals in this fashion, things can be made to happen
at compile time.<BR>
<BR>
In particular, a file can contain a directive to the system to compile
another file, and so large programs can be split between files, while
still only requiring a single simple command to compile them.
<A NAME="@default8"></A> When this happens,
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> interprets the pathnames of the nested compiled files
relative to the directory of the parent compiled file; if, for
example, the user calls
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
[eclipse 1]: compile('src/pl/prog').
</PRE></BLOCKQUOTE>
and the file src/pl/prog.pl contains a query
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
:- [part1, part2].
</PRE></BLOCKQUOTE>
then the system searches for the files <TT>part1.pl</TT> and <TT>part2.pl</TT> in the directory <TT>src/pl</TT> and not in the current
directory. Usually larger ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> programs have one main file
which contains only commands to compile all the subfiles. In
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> it is possible to compile this main file from any
directory. (Note that if your program is large enough to warrant
breaking into multiple files (let alone multiple directories), it is
probably worth turning the constituent components into modules.)

<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<B>&#8857;</B><DD CLASS="dd-description"> <FONT COLOR="#9832CC">See section&nbsp;</FONT><A HREF="tutorial033.html#secmodules"><FONT COLOR="#9832CC">4.10</FONT></A><FONT COLOR="#9832CC"> for more information about modules.</FONT>
</DL>

<HR>
<A HREF="tutorial008.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="tutorial003.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="tutorial010.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
